1. Technical Field
The present invention relates generally to the field of computer systems, and more specifically to a system, method, and computer program product for reducing overhead associated with software lock monitoring in a multiple-processor data processing system having a memory that is shared among the multiple processors.
2. Description of Related Art
A symmetric multiprocessing system (SMP) includes multiple processors that share one or more memory devices. Software routines executing within the multiple processors can access the shared-memory. In order to prevent multiple software routines from simultaneously accessing the same memory location within the shared-memory, SMP systems may implement software locks.
When software locks are utilized, memory locations within the shared-memory are associated with locks. In order for a software routine to access a particular memory location, the software routine must get the lock that is associated with that memory location. A software lock is typically implemented as a bit in a particular memory location. When the lock bit is set to a logical one, a lock has been taken and software routines other than the one having the lock may not access the memory location. When the lock bit is set to a logical zero, a software routine may take the lock. When a software routine takes a lock, the software routine sets the lock bit equal to a logical one. The process of getting a lock is an atomic process such that there are hardware features that guarantee that only one software routine may obtain a lock at a time.
If a first software routine tries to get a lock on a memory location by testing that memory location""s lock bit and the lock bit is set, another software routine currently has the lock. When the first software routine is not able to get a lock because another software routine has the lock, it is called xe2x80x9cmissingxe2x80x9d a lock.
If the first software routine missed the lock, the first software routine enters a spinning loop whereby the first software routine continues to test the lock bit until the lock bit is cleared. When the lock bit is cleared, the first software routine may get the lock and thus access the particular memory location.
It is helpful to monitor the activities of the various locks implemented in an SMP system in order to enhance the performance of the SMP system and the applications executing within the system. Effective management and enhancement of data processing systems requires knowing how and when various system resources are being used. Performance tools are used to monitor and examine a data processing system to determine resource consumption as various software applications are executing with the data processing system.
One known software performance tool is a trace tool. A trace tool may use more than one technique to provide trace information that indicates execution flows for an executing program. One technique keeps track of particular sequences of instructions by logging certain events as the occur. When a particular event occurs, a trace hook may be emitted which includes various parameters associated with the particular event.
In an SMP system, substantial system resources are required to fully monitor lock activities. When lock activities are fully monitored, all activity associated with getting or missing a lock is tracked. Data is therefore obtained that is associated with either getting or missing a lock. Thus, the performance of a system that includes full lock monitoring is significantly degraded. Further, when full lock monitoring is implemented in a system, the system does not perform as it would if the lock monitoring were not implemented. The behavior of the system is changed because the implementation of the monitoring produces a sequence of events that would not result without the monitoring.
One solution to the problem has been to build two kernels, one with full lock monitoring for testing purposes and one without any lock monitoring for shipping to customers. Thus, the system shipped to a customer would include a kernel that did not have any lock monitoring. This is problematic, however, because lock monitoring may be needed in a customer environment.
A need exists for a system, method, and computer program product for including lock monitoring functionality in a multiple-processor system while also reducing the overhead associated with the lock monitoring.
A system, method, and computer program product are disclosed for reducing overhead associated with software lock monitoring in a multiple-processor data processing system having a memory that is shared among the multiple processors. Multiple memory locations in the shared-memory are associated with one of multiple locks. Overhead is reduced by generating a trace hook only in response to activity associated with lock misses.
The above as well as additional objectives, features, and advantages of the present invention will become apparent in the following detailed written description.